package com.xxx.Map;

import java.util.HashMap;

/**
 * @version v1.0
 * @Description
 * @Author admin
 * @date 2021/7/21  14:33
 * @Copyright
 */
public class HashMapDome01 {
    public static void main(String[] args) {

        //n1();
        //c1();
        //query();
        panduan();
    }

    private static void panduan() {//判断
        HashMap<String ,String> stringHashMap = new HashMap<>();
        stringHashMap.put("张三","男");
        stringHashMap.put("张六","女");
        System.out.println(stringHashMap.containsKey("张三"));
        System.out.println(stringHashMap.containsValue("女"));
        System.out.println(stringHashMap.isEmpty());
    }

    private static void query() {//查
        HashMap<String ,String> stringHashMap = new HashMap<>();
        stringHashMap.put("张三","男");
        stringHashMap.put("张六","女");
        System.out.println(stringHashMap.size());
        System.out.println(stringHashMap.get("张三"));
    }

    private static void c1() {//删
        HashMap<String ,String> stringHashMap = new HashMap<>();
        stringHashMap.put("张三","男");
        stringHashMap.put("张六","女");
        stringHashMap.put("李四","男");
        stringHashMap.remove("李四");//删除
        stringHashMap.clear();//清空
    }

    private static void n1() {//增
        HashMap<String ,String> stringHashMap = new HashMap<>();
        stringHashMap.put("张三","男");
        stringHashMap.put("张六","女");
        stringHashMap.put("张四","男");
        System.out.println(stringHashMap.put("第几次","撒撒擦"));
        System.out.println(stringHashMap);
    }
}
